package hzncc.wcs.config;




import com.intelligt.modbus.jlibmodbus.Modbus;
import com.intelligt.modbus.jlibmodbus.exception.ModbusIOException;
import com.intelligt.modbus.jlibmodbus.master.ModbusMaster;
import com.intelligt.modbus.jlibmodbus.master.ModbusMasterFactory;
import com.intelligt.modbus.jlibmodbus.net.ModbusConnectionFactory;
import com.intelligt.modbus.jlibmodbus.tcp.TcpParameters;
import hzncc.wcs.modbus.service.ModbusService;
import hzncc.wcs.mqtt.MqttGateway;
import jakarta.annotation.PostConstruct;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.stream.IntStream;

@Configuration
public class ModbusConfig {


    @Bean(initMethod = "init")
    public ModbusService modbusService() throws UnknownHostException, ModbusIOException {
        ModbusService modbusService = new ModbusService();
        modbusService.init();
        return modbusService;
    }
}
